package com.github.ilioili.justdoit.util;

import com.github.ilioili.justdoit.common.config.EventConstants;
import com.github.ilioili.justdoit.model.pojo.EventRecord;
import com.github.ilioili.justdoit.model.pojo.ScheduleEvent;
import com.github.ilioili.justdoit.util.sql.DbUtil;

/**
 * Created by User on 16/6/18.
 */
public class StatisticUtil {
    public static int getCompeteCount(long scheduleEventId) {
        return DbUtil.getCount(EventRecord.class, " _eventId = " + scheduleEventId + " and _state in(" + EventConstants.STATE_COMPLETE + " , " + EventConstants.STATE_AMOST_COMPLETE + " , " + EventConstants.STATE_MAKE_UP + ")");
    }

    public static int getTotalCount(ScheduleEvent scheduleEvent, long endTime) {
        return DateUtil.getTotalMatchedDayNum(scheduleEvent, endTime);
    }

}
